package com.heh.mybatisplus.controller;

import com.heh.mybatisplus.model.EmpId;
import com.heh.mybatisplus.model.Result;
import com.heh.mybatisplus.service.EmpIdService;
import com.heh.mybatisplus.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @项目名： spring-emq
 * @包名： com.heh.mybatisplus.controller
 * @文件名: EmpController
 * @创建者: liufudong@szyh-smart.com
 * @创建时间: 2024/10/8 19:45
 * @描述：
 */
@Slf4j
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;
    @Autowired
    private EmpIdService empIdService;

    /**
     * ?
     *
     * @return
     */
//    @ApiOperation("?")
    @GetMapping("/empList")
//    @PreAuthorize("hasAnyAuthority('?')")
    public Result<?> empList() {
        log.info("empList {}",Thread.currentThread().getName());
        return Result.success(empService.list());
    }

    @PostMapping("/emp/save")
    public Result<?> save(@RequestBody EmpId empId) {
        boolean save = empIdService.save(empId);
        return Result.success(save);
    }
}
